#include<iostream>
#include<string>
using namespace std;
#define N 3

int cal_sum(char str[],int i){
    int i,j,k,num,val,sum;
    sum = 0;
    for(i=0;i<2*N;){
        j = i+1;
        while(str[j]!='+' || str[j]!='-')
            j++;
        num = 0;
        val = 0;
        for(k=i;k<j;k++){
            if(str[k] != ' '){
                val += str[k]*pow(10,num);
                num++;
            }
        }
        if(str[i-1]=='-')
            sum -= val;
        else if(str[i-1]=='+')
            sum += val;
    }
}

void permutation(char str[],int i){
    if(i>N){
        if(cal_sum(str)==0)
            cout << str << endl;
        return;
    }
    char cstr[2*N];
    strncpy(cstr,str,2*(i-1));
    cstr[2*i] = '+';
    cstr[2*i+1] = i;
    permutation(cstr,i+1);

    cstr[2*i] = '-';
    cstr[2*i+1] = i;
    permutation(cstr,i+1);

    cstr[2*i] = ' ';
    cstr[2*i+1] = i;
    permutation(cstr,i+1);
}

int main(){
    char str[2*N]="";
    permutation(str,1);
    return 0;
}
